package 异常0907;

import java.util.InputMismatchException;
import java.util.Scanner;

public class try_catch嵌套 {
    public static void main(String[]args){
        Scanner i=new Scanner(System.in);//实例化Scann对象
        System.out.println("请输入两个整数：");
        try {
            int a=i.nextInt();//输入一个整数存入变量a中
            int b=i.nextInt();
            try {
                int c=a/b;
                System.out.println("商为："+c);
            } catch (Exception e) {
                System.out.println("除数不能为0！");
            }
        } catch (Exception e) {
            System.out.println("只能输入整数！");
        }
    }
}
